package com.sakiko.ai.controller;

import org.springframework.ai.chat.model.ChatModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * projectName: com.sakiko.ai.controller
 *
 * @author: Yang
 * description:
 * time: 2025/8/7 19:24
 */
@RestController
@RequestMapping("ai")
public class MoonshotController {

    @Autowired
    private ChatModel chatModel;

    @GetMapping("generate")
    public String generate(@RequestParam(value = "message", defaultValue = "hello") String message) {
        String res = chatModel.call(message);
        System.out.println("res = " + res);
        return res;
    }

}
